package com.wuye.parking.service.impl;

import java.util.ArrayList;
import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuye.parking.mapper.WyParkingLotMapper;
import com.wuye.parking.domain.WyParkingLot;
import com.wuye.parking.service.IWyParkingLotService;

/**
 * 车位查询Service业务层处理
 * 
 * @author avalon
 * @date 2024-11-23
 */
@Service
public class WyParkingLotServiceImpl extends ServiceImpl<WyParkingLotMapper,WyParkingLot>  implements IWyParkingLotService
{
    @Autowired
    private WyParkingLotMapper wyParkingLotMapper;

    /**
     * 查询车位查询
     * 
     * @param parkId 车位查询主键
     * @return 车位查询
     */
    @Override
    public WyParkingLot selectWyParkingLotByParkId(Long parkId)
    {
        return wyParkingLotMapper.selectWyParkingLotByParkId(parkId);
    }

    /**
     * 查询车位查询列表
     * 
     * @param wyParkingLot 车位查询
     * @return 车位查询
     */
    @Override
    public List<WyParkingLot> selectWyParkingLotList(WyParkingLot wyParkingLot)
    {
        return wyParkingLotMapper.selectWyParkingLotList(wyParkingLot);
    }

    /**
     * 新增车位查询
     * 
     * @param wyParkingLot 车位查询
     * @return 结果
     */
    @Override
    public int insertWyParkingLot(WyParkingLot wyParkingLot)
    {
        return wyParkingLotMapper.insertWyParkingLot(wyParkingLot);
    }

    /**
     * 修改车位查询
     * 
     * @param wyParkingLot 车位查询
     * @return 结果
     */
    @Override
    public int updateWyParkingLot(WyParkingLot wyParkingLot)
    {
        return wyParkingLotMapper.updateWyParkingLot(wyParkingLot);
    }

    /**
     * 批量删除车位查询
     * 
     * @param parkIds 需要删除的车位查询主键
     * @return 结果
     */
    @Override
    public int deleteWyParkingLotByParkIds(Long[] parkIds)
    {
        return wyParkingLotMapper.deleteWyParkingLotByParkIds(parkIds);
    }

    /**
     * 删除车位查询信息
     * 
     * @param parkId 车位查询主键
     * @return 结果
     */
    @Override
    public int deleteWyParkingLotByParkId(Long parkId)
    {
        return wyParkingLotMapper.deleteWyParkingLotByParkId(parkId);
    }
    /**
     * 查询某个小区下车位的总数和租用中车位的总数
     */
    @Override
    public List selectParkingAndRentParkingTotal(Long communityId){
        List list = new ArrayList();
        int i = wyParkingLotMapper.selectParkingTotal(communityId);
        int i1 = wyParkingLotMapper.selectRentParkingTotal(communityId);
        list.add(i);
        list.add(i1);
        return list;
    }
}
